import React, { useEffect } from 'react';
import Greeter from './Greet';
import Dog from './Dog';
import Horse from './Horse';
import Employee from './Employee';
import Octopus from './Octopus';
import Grid from './Grid';
import Animal from './Animal';
import Waiter from './Waiter';
import AccountingDepartment from './AccountingDepartment'
import Point from './Point';
// import './Student'

interface IPoint3d extends Point {
    z: number
}

const Classes = () => {

    const init = () => {
        const greeter = new Greeter('world')
        const info = greeter.greet()
        console.log(info)
        const dog = new Dog('miki', 4);
        dog.move(100)
        const horse = new Horse('GuGu');
        horse.move()
        let animal = new Animal('GoGo');
        animal = dog
        console.log(animal)
    }

    const initEmployee = () => {
        const employee = new Employee();
        employee.fullName = 'Bob Smith';
        if(employee.fullName){
            console.log(employee.fullName)
        }

        const waiter = new Waiter('kitty', 'room');
        waiter.getElevatorPicth()
    }

    const initRead = () => {
        const o1 = new Octopus('kiki')
        // o1.name = 'kk' 报错 name是只读属性
        console.log(o1.name)
    }

    const initGrid = () => {
        const grid1 = new Grid(1.0);
        const grid2 = new Grid(5.0);
        console.log(grid1.calculateDistanceFromOrigin({x: 10, y: 10}))
        console.log(grid2.calculateDistanceFromOrigin({x: 10, y: 10}))
    }

    const initAbstract = () => {
        const depart = new AccountingDepartment();
        depart.printName()
        depart.printMeeting()
        depart.generateReports()
    }

    useEffect(() => {
        init()
        initEmployee()
        initRead()
        initGrid()
        initAbstract()
        const point3d: IPoint3d = {x: 1, y: 1, z: 1}
        console.log(point3d)
    }, [])

    return <div>classes</div>
}

export default Classes;
